package com.example.abe.diandi.category.adapter;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import com.example.abe.diandi.R;
import com.example.abe.diandi.category.model.CategoryModel;

import example.abe.com.framework.recycleview.base.ItemViewDelegate;
import example.abe.com.framework.recycleview.base.ViewHolder;

/**
 * Created by abe on 17/3/14.
 */

public class CategoryDelegate implements ItemViewDelegate<CategoryModel> {

    @Override
    public boolean isForViewType(CategoryModel item, int position) {
        return true;
    }

    @Override
    public View getItemView(Context context, ViewGroup parent) {
        View view = LayoutInflater.from(context).inflate(R.layout.item_category, parent, false);
        return view;
    }

    @Override
    public void bindViewHolder(ViewHolder holder, CategoryModel t, int position) {
        holder.setText(R.id.item_category_tv_count, "" + t.getCount());
        holder.setText(R.id.item_category_tv_title, t.getTitle());
    }

}
